using System.ComponentModel;

namespace MvvmFx.Common.ViewModels.Behaviors.Validation
{
    public partial class ValidationService
    {
        /// <summary>
        /// Event handler for the PropertyChanged event of the ViewModel
        /// object being tracked. This marks the ChangeService as being
        /// modified, and maintains hooks to a trackable child object if
        /// the TrackingMode is TrackChildren.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ViewModelPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var propertyNames = ValidationRules.CheckRules(e.PropertyName);
            foreach (var name in propertyNames)
            {
                // OnPropertyChanged(name);
                ValidationRules.CheckRules(name);
            }
        }
    }
}